package org.csmzxy.class2333;

public class Example07 {
    public static void main(String[] args){
        String id = "user";
        String time = "2023-1112-1336";
        //字符串拼接操作
        String orderId = id.concat(time);
        System.out.println("将字符串" + time + "拼接到字符串" + id + "的末尾," + "生成的订单号为" + orderId);
        //字符串截取操作
        System.out.println("截取字符串" + orderId + "的第5个字符到第14个字符," + "结果为" + orderId.substring(4,13));
        //字符串分割操作
        System.out.println("将字符串" + time +"用符号-分割为若干个字符串,结果为");
        String[] times = time.split("-");
        for (int i = 0; i < times.length; i++){
            if(i != times.length - 1){
                System.out.println(times[i] + ",");
            }else {
                System.out.println(times[i]);
            }
        }
    }
}
